﻿using AntdUI;
using MySql.Data.MySqlClient;
using Mysqlx.Crud;
using NPOI.SS.Formula.Functions;
using NPOI.SS.Formula.PTG;
using NPOI.SS.UserModel;
using NPOI.Util;
using NPOI.XSSF.UserModel; // 用于 .xlsx 文件
using ScottPlot;
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace BST250301.Views
{
    public partial class Analysis : UserControl
    {
        private AntdUI.Window window;
        public Analysis()
        {
            InitializeComponent();
            InitData();
            InitTableColumns();
            BindEventHandler();

        }

        private void BindEventHandler()
        {
        }

        private void InitData()
        {

        }
        private void InitTableColumns()
        {


        }

    
        private void btnRefrence_Click(object sender, EventArgs e)
        {
            PlotDemo();
        }
        private void Table_base_CellClick(object sender, TableClickEventArgs e)
        {
           
        }

        private void PlotDemo()
        {
            ScottPlot.Plot myPlot = new();

            myPlot.Add.Scatter(Generate.Consecutive(51), Generate.Sin(51));
            myPlot.Add.Signal(Generate.Cos());
            myPlot.Add.HorizontalLine(0.75);

            // remove every instance of a specific plottable type
            myPlot.Remove<ScottPlot.Plottables.Signal>();

            myPlot.Axes.Title.Label.FontName = Fonts.Detect("test/测试");

            double[] values = Generate.RandomNormal(300000, stdDev: 0.2);
            for (int i = 1; i < 2; i++)
            {
                var sig = myPlot.Add.Signal(values);
                sig.Data.YOffset = i * 3;
                sig.LineWidth = 1.5f;
                values = Generate.AddSin(values, oscillations: i);
            }
            formsPlot1.Multiplot.AddPlot(myPlot);
            formsPlot1.Refresh();
        }
    }
}
